package com.itheima.lianxi;

import java.io.File;
/*
    递归
 */
public class Demo02 {
    public static void main(String[] args) {
        File file = new File("D:\\aaa");
        deleteFile(file);
    }

    private static void deleteFile(File file) {
        if (file != null) {
            File[] files = file.listFiles();
            if (files != null) {
                for (File f : files) {
                    if (f.isDirectory()){
                        deleteFile(f);
                    }else{
                        f.delete();
                    }
                }
            }
            file.delete();
        }
    }
}
